﻿<navigation:Page x:Class="TheCollectiveNetwork.Views.Administration.RegistrationRequests" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"           
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
           xmlns:CustomControls="clr-namespace:TheCollectiveNetwork.CustomControls"  
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
           xmlns:cvt="clr-namespace:TheCollectiveNetwork.Classes.Converters"
           mc:Ignorable="d" d:DesignWidth="980" d:DesignHeight="600"
           Title="Registration Requests">
    
    <UserControl.Resources>
        <cvt:DataGridRowErrorConverter x:Key="DataGridRowErrorCvt"/>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot">

        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >
            <controlsToolkit:DockPanel Background="White" LastChildFill="True" >

             <TextBlock x:Name="HeaderText" controlsToolkit:DockPanel.Dock="Top"   Style="{StaticResource HeaderTextStyle}" Text="{Binding Path=ApplicationStrings.RegistrationRequestsTitle, Source={StaticResource ResourceWrapper}}"/>
                <StackPanel Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="255" />
                        <ColumnDefinition Width="510" />
                        <ColumnDefinition Width="190" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="100*" />
                    </Grid.RowDefinitions>

                    <CheckBox x:Name="SelectAllCheckBox" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" IsChecked="False" Margin="10" Content="On this page select all registrations" Click="SelectAllCheckBox_Click" />
                          
                    <StackPanel x:Name="RegistrationButtonsPanel" Margin="10" Orientation="Horizontal"  Height="40" Grid.Column="1" Grid.Row="0">
                            <Button x:Name="RegistrationApproveButton" Margin="0,0,10,0" Click="RegistrationApproveButton_Click" Width="240"  HorizontalAlignment="Left" Content="Approve selected registrations" Style="{StaticResource GreenTickButtonStyle}" />                              
                            <Button x:Name="RegistrationDeleteButton" Margin="0" Content="Delete selected registrations" Click="RegistrationDeleteButton_Click" Width="240" HorizontalAlignment="Left"  Style="{StaticResource RedCrossButtonStyle}"/>
                    </StackPanel>
                        <sdk:DataPager x:Name="UserListDataPager"   PageSize="15" DisplayMode="PreviousNext" Margin="0,5,10,0" Background="#FFFFFFFF"  VerticalAlignment="Center" BorderThickness="0" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="0" PageIndexChanged="UserListDataPager_PageIndexChanged" PageIndexChanging="UserListDataPager_PageIndexChanging"/>
                </Grid>

                <CustomControls:CustomList x:Name="RegistrationMessage_CustomList" />

                <sdk:DataGrid x:Name="UserListDataGrid" Margin="0" AutoGenerateColumns="False" HeadersVisibility="Column" BorderThickness="0" GridLinesVisibility="Horizontal" SelectionMode="Single" IsReadOnly="True" >
                      
                        <sdk:DataGrid.CellStyle>
                            <Style TargetType="sdk:DataGridCell">
                                <Setter Property="Background" Value="{Binding Path=processing_error, Converter={StaticResource DataGridRowErrorCvt}}"/>
                            </Style>
                        </sdk:DataGrid.CellStyle>

                      <sdk:DataGrid.Columns >
                      <sdk:DataGridTemplateColumn Width="150" Header="Select to Process" >
                          <sdk:DataGridTemplateColumn.HeaderStyle>
                              <Style TargetType="sdk:DataGridColumnHeader">
                                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
                               </Style>
                          </sdk:DataGridTemplateColumn.HeaderStyle>
                          <sdk:DataGridTemplateColumn.CellTemplate>
                              <DataTemplate>
                                        <CustomControls:GuidCheckBox x:Name="RegistrationSelectCheckBox" HorizontalAlignment="Center" VerticalAlignment="Center" IsThreeState="False" IsChecked="{Binding process, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" GuidID="{Binding User_GUID, Mode=OneWay}" Click="RegistrationSelectCheckBox_Click"/>
                              </DataTemplate>
                              </sdk:DataGridTemplateColumn.CellTemplate>
                          </sdk:DataGridTemplateColumn>
                          <sdk:DataGridTextColumn Header="Email" Binding="{Binding email, Mode=OneTime}" />
                          <sdk:DataGridTextColumn Header="Organisation" Binding="{Binding organisation, Mode=OneTime}" />
                          <sdk:DataGridTextColumn Header="First Name" Binding="{Binding first_name, Mode=OneTime}" />
                          <sdk:DataGridTextColumn Header="Last Name" Binding="{Binding last_name, Mode=OneTime}" />
                          <sdk:DataGridTextColumn Header="Phone" Binding="{Binding phone_number, Mode=OneTime}" />
                          <sdk:DataGridTextColumn Header="Date Registered" Binding="{Binding datetimecreated, Mode=OneTime}" />
                          <sdk:DataGridTextColumn x:Name="ProcessingMessageColumn" Header="Processing Message" Binding="{Binding processing_message, Mode=OneTime}" />                                
                             
                        </sdk:DataGrid.Columns>
                </sdk:DataGrid>

                    
                </StackPanel>
          </controlsToolkit:DockPanel>
        </ScrollViewer>

    </Grid>
</navigation:Page>
